﻿using System.Collections.Generic;
using Newtonsoft.Json;
namespace Business.Entities.Actions
{
    /// <summary>
    /// Top-level class for a request to google
    /// </summary>
    public class GoogleRequest
    {
        public List<GoogleAction> action_list;
        public long client_version;
        public string current_list_id;
        public long latest_sync_point;
        [JsonIgnore]
        public int _actionCounter = 1;

        public GoogleAction GetAction(string action_id)
        {
            foreach (GoogleAction action in action_list)
            {
                if (action.action_id == action_id) return action;
            }
            return null;
        }

        /// <summary>
        /// Adds an action to the action list
        /// </summary>
        /// <param name="action"></param>
        public void AddAction(GoogleAction action)
        {
            action_list.Add(action);
            action.action_id = (_actionCounter++).ToString();
        }

        
    }
}
